package com.qumap.common.item;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 13.06.11
 * Time: 22:06
 * To change this template use File | Settings | File Templates.
 */
public enum Operations {

    Equals("="),
    Above(">"),
    Below("<"),
    AboveOrEquals(">="),
    BelowOrEquals("<=");

    private static Map<String, Operations> shortcut_to_operations;
    private String shortcut;
    private byte operation_index;

    Operations(String shortcut) {
        this.shortcut = shortcut;
        operation_index = (byte)ordinal();
        init();
    }

    public byte getOperationIndex() {
        return operation_index;
    }

    private void init() {
        if(shortcut_to_operations == null)
            shortcut_to_operations = new HashMap<String, Operations>();
        shortcut_to_operations.put(shortcut, this);
    }

    public static Operations getOperation(String operation_shortcut) {
        return shortcut_to_operations.get(operation_shortcut);
    }

}
